package com.jxw.cloudpen.web.palpay;

import com.paypal.api.payments.Payment;
import com.paypal.api.payments.Refund;
import com.paypal.base.rest.PayPalRESTException;

/**
 * @author ligang
 * @create 2025/5/19 15:49
 */
public interface PayPalService {
    /**
     * 创建订单
     * @param total
     * @param currency
     * @param method
     * @param intent
     * @param description
     * @param cancelUrl
     * @param successUrl
     * @return
     * @throws PayPalRESTException
     */
    Payment createPayment(Double total, String currency, String method, String intent, String description, String cancelUrl, String successUrl) throws PayPalRESTException;

    /**
     * 执行支付
     * @param paymentId
     * @param payerId
     * @return
     * @throws PayPalRESTException
     */
    Payment executePayment(String paymentId, String payerId) throws PayPalRESTException;

    Refund refundPayment(String captureId, String amount, String currency) throws PayPalRESTException;

    Refund getRefundDetails(String refundId) throws PayPalRESTException;
}
